<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Selection Iteration</title>
    <link rel="stylesheet" type="text/css" href="../../css/styles.css"/>
    <script type="text/javascript" src="../../lib/d3.js"></script>
</head>

<body>

<div></div>
<div></div>
<div></div>

<script type="text/javascript">
    d3.selectAll("div") // <-- A
            .attr("class", "red box") // <-- B
            .each(function (d, i) { // <-- C
                d3.select(this).append("h1").text(i); // <-- D
            });
</script>

</body>
</html>